/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

/* Ensure consistent title background regardless of number of views */
.composite.viewlet[id="workbench.view.chat.sessions"] .pane-header.expanded.not-collapsible {
	background-color: var(--vscode-sideBarSectionHeader-background) !important;
}

/* Style for empty state message */
.chat-sessions-message {
	padding: 20px;
	text-align: center;
	color: var(--vscode-descriptionForeground);
}

.chat-sessions-message .no-sessions-message {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-style: italic;
}

/* Simple approach - directly style the edit container for chat sessions */
.chat-sessions-tree-container .explorer-item.explorer-item-edited {
	display: flex;
	align-items: center;
	height: 22px;
	padding: 0;
}

.chat-sessions-tree-container .explorer-item.explorer-item-edited .codicon {
	margin-right: 6px;
	flex-shrink: 0;
}

.chat-sessions-tree-container .explorer-item.explorer-item-edited .monaco-inputbox {
	flex: 1;
	width: 100%;
	line-height: normal;
	border: none !important;
	background: transparent !important;
}

/* Add the complete outline border that file explorer uses (this replaces the border) */
.chat-sessions-tree-container .explorer-item.explorer-item-edited .monaco-inputbox input[type="text"] {
	outline-width: 1px;
	outline-style: solid;
	outline-offset: -1px;
	outline-color: var(--vscode-focusBorder);
	opacity: 1;
	border: none !important; /* Remove any default border */
}

/* Position session content and actions inline */
.chat-sessions-tree-container .chat-session-item .session-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	min-height: 22px;
	line-height: 22px;
}

.chat-sessions-tree-container .chat-session-item .description-row {
	display: none;
	opacity: 0.5;
	font-size: 0.9em;
	line-height: 1em;
	margin: 2px 22px 0 22px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chat-sessions-tree-container .chat-session-item .actions {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

/* Hide actions by default, show on hover and focus */
.chat-sessions-tree-container .chat-session-item .actions .monaco-action-bar .action-label {
	opacity: 0;
}

.chat-sessions-tree-container .chat-session-item:hover .actions .monaco-action-bar .action-label,
.chat-sessions-tree-container .monaco-list-row.focused .chat-session-item .actions .monaco-action-bar .action-label,
.chat-sessions-tree-container .monaco-list-row.selected .chat-session-item .actions .monaco-action-bar .action-label {
	opacity: 1;
}

/* For items with descriptions, keep the structure but adjust alignment */
.chat-sessions-tree-container .chat-session-item .session-content {
	align-items: center;
	padding-top: 0;
	padding-bottom: 0;
}

/* Ensure resource label takes up available space */
.chat-sessions-tree-container .chat-session-item .monaco-icon-label {
	flex: 1;
	min-width: 0; /* Allow text to truncate */
	text-overflow: ellipsis;
	overflow: hidden;
}

.chat-sessions-tree-container .chat-session-item .monaco-icon-label::before {
	text-align: center;
}

.chat-sessions-tree-container .chat-session-item .monaco-icon-label.codicon-loading::before {
	animation: codicon-spin 1.5s steps(30) infinite;
}

/* Timestamp styling - similar to timeline pane */
.chat-sessions-tree-container .chat-session-item .timestamp-container {
	margin-left: auto;
	margin-right: 4px;
	opacity: 0.5;
	overflow: hidden;
	text-overflow: ellipsis;
	flex-shrink: 0;
	font-size: 0.9em;
	min-width: 10px;
}

.chat-sessions-tree-container .chat-session-item .timestamp-container.timestamp-duplicate::before {
	content: ' ';
	position: absolute;
	right: 10px;
	border-right: 1px solid currentColor;
	display: block;
	height: 100%;
	width: 1px;
	opacity: 0.25;
}

.chat-sessions-tree-container .monaco-list-row:hover .chat-session-item .timestamp-container.timestamp-duplicate::before,
.chat-sessions-tree-container .monaco-list-row.selected .chat-session-item .timestamp-container.timestamp-duplicate::before,
.chat-sessions-tree-container .monaco-list-row.focused .chat-session-item .timestamp-container.timestamp-duplicate::before {
	display: none;
}

.chat-sessions-tree-container .chat-session-item .timestamp-container .timestamp {
	display: inline-block;
}

.chat-sessions-tree-container .chat-session-item .timestamp-container.timestamp-duplicate .timestamp {
	visibility: hidden;
	width: 10px;
}

.chat-sessions-tree-container .monaco-list-row:hover .chat-session-item .timestamp-container.timestamp-duplicate .timestamp,
.chat-sessions-tree-container .monaco-list-row.selected .chat-session-item .timestamp-container.timestamp-duplicate .timestamp,
.chat-sessions-tree-container .monaco-list-row.focused .chat-session-item .timestamp-container.timestamp-duplicate .timestamp {
	visibility: visible !important;
	width: initial;
}

.chat-sessions-tree-container .monaco-list-row .actions {
	display: none;
}

.chat-sessions-tree-container .monaco-list-row:hover .actions {
	display: block;
}

/* Hide twisties for elements that don't have children */
.chat-sessions-tree-container .monaco-list-row .monaco-tl-twistie {
	visibility: hidden;
	width: 0;
	padding: 0;
	margin: 0;
}

/* Show twistie only for collapsible items (like "Show history...") */
.chat-sessions-tree-container .monaco-list-row[aria-expanded] .monaco-tl-twistie {
	visibility: visible;
	width: auto;
	padding-left: 0px;
	padding-right: 6px;
	margin: initial;
}

/* History items styling */
.chat-sessions-tree-container .chat-session-item[data-history-item="true"] {
	opacity: 0.9;
}

.chat-sessions-tree-container .chat-session-item[data-history-item="true"]:hover {
	background-color: var(--vscode-list-hoverBackground);
}
